<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});


Route::post('/category/add', 'CategoryController@add');

Route::put('/category/{id}', 'CategoryController@update')->where(['id' => '\d*']);

Route::delete('/category/{id}', 'CategoryController@delete')->where(['id' => '\d*']);

Route::get('/category/search', 'CategoryController@search');




Route::post('/product', 'ProductController@add');

Route::get('/product/{id}', 'ProductController@getDetail')->where(['id' => '\d*']);

Route::get('/product1/{id}', 'ProductController@getDetail1')->where(['id' => '\d*']);

Route::put('/product/{id}', 'ProductController@update')->where(['id' => '\d*']);

Route::delete('/product/{id}', 'ProductController@delete')->where(['id' => '\d*']);

Route::get('/product/unit', 'ProductController@getUnit');

Route::post('/product/brand', 'ProductController@getBrand');


Route::post('/product/image', 'ProductController@uploadImage');


Route::post('/product/qiniu', 'ProductController@uploadQiNiu');


Route::get('/product/ranking', 'ProductController@getRanking');

Route::post('/product/sell/{id}', 'ProductController@sell')->where(['id' => '\d*']);

